package com.zzg.mybatis.generator.model;

import java.util.Objects;

import lombok.Data;

/**
 * Created by Owen on 5/13/16.
 */
@Data
public class DatabaseConfig {

	/**
	 * The primary key in the sqlite db
	 */
	private Integer id;

	/**
	 * 数据库类型
	 */
	private String dbType;
	
	/**
	 * The name of the config 别名
	 */
	private String name;

	/**
	 * 主机名或ip地址
	 */
	private String host;

	/**
	 * 端口
	 */
	private String port;

	/**
	 * schema/数据库
	 */
	private String schema;

	/**
	 * 用户名
	 */
	private String username;

	/**
	 * 密码
	 */
	private String password;

	/**
	 * 编码
	 */
	private String encoding;


	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;
		DatabaseConfig that = (DatabaseConfig) o;
		return Objects.equals(dbType, that.dbType) && Objects.equals(name, that.name) && Objects.equals(host, that
				.host) && Objects.equals(port, that.port) && Objects.equals(schema, that.schema) && Objects.equals
				(username, that.username) && Objects.equals(password, that.password) && Objects.equals(encoding, that
				.encoding);
	}

	@Override
	public int hashCode() {
		return Objects.hash(dbType, name, host, port, schema, username, password, encoding);
	}

	@Override
	public String toString() {
		return "DatabaseConfig{" + "dbType='" + dbType + '\'' + ", name='" + name + '\'' + ", host='" + host + '\'' +
				", port='" + port + '\'' + ", schema='" + schema + '\'' + ", username='" + username + '\'' + ", " +
				"password='" + password + '\'' + ", encoding='" + encoding + '\'' + '}';
	}
}
